﻿using System.Windows.Forms;
using pub.CmdUI.Cmd;
using pub.CmdUI.UI.Control;

namespace todo.Cmd.View
{
    public class ShowHeaderCmd : DefaultCmd, ICmdState
    {
        public ShowHeaderCmd()
        {
            Shortcut = new CmdShortcut(Keys.Control | Keys.H);
        }

        bool? ICmdState.Checked
        {
            get { return App.Settings.HeaderVisible; }
        }

        public override void Execute(IControlUI controlUi)
        {
            App.Settings.HeaderVisible = !App.Settings.HeaderVisible;
            TodoApi.Instance.SetHeaderVisible(App.Settings.HeaderVisible);
        }
    }
}